home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / libdmalloc / Makefile < prev    next >
Encoding:
Makefile  |  1994-08-02  |  1.9 KB  |  59 lines

  1. # NOTE:
  2. #    The reason getwd.c is included here is
  3. #    that the libc version has a bug in which it looks at freed
  4. #    memory.
  5. #    This malloc library fills all freed memory with a fill pattern,
  6. #    which causes libc's getwd to fail.
  7. #    When that is fixed for good, we can take getwd.c out of this source,
  8. #    and take out -DGETWD_PATCH from ../Makefile.
  9.  
  10. include $(ROOT)/usr/include/make/commondefs
  11.  
  12. LCOPTS    = -O2
  13. LCDEFS    = -DGETWD_PATCH
  14.  
  15. # This is the way for 4.0.5, but they moved it for IRIX 5...
  16. REAL_LIBMALLOC_TRY_FIRST = /usr/lib/libmpc.a
  17. REAL_LIBMALLOC = /usr/lib/libmalloc.a
  18. REAL_LIBMALLOC_OFILES = malloc.o
  19.  
  20. CFILES    = dmalloc.c dmalloc_q.c stacktrace.c stacktrace_s.c malloc.c
  21. OTHERSOURCE = getwd.o
  22.  
  23. LDIRT    = libdmalloc.-g.a so_locations
  24. TARGETS    = libdmalloc.a libdmalloc.so libdmalloc.-g.so
  25.  
  26. default all: $(TARGETS)
  27.  
  28. include $(COMMONRULES)
  29.  
  30. CLEANOBJECTS = ${OBJECTS}
  31. GDIRT   = ${OBJECTS} a.out core lex.yy.[co] y.tab.[cho] $(_FORCE)
  32.  
  33. $(REAL_LIBMALLOC_OFILES): $(REAL_LIBMALLOC_TRY_FIRST) $(REAL_LIBMALLOC)
  34.     ar x $(REAL_LIBMALLOC_TRY_FIRST) $(REAL_LIBMALLOC_OFILES) || \
  35.         ar x $(REAL_LIBMALLOC) $(REAL_LIBMALLOC_OFILES)
  36.     @echo "(at most 1 error from the previous command is okay IF you are on IRIX 5)"
  37.     perl -p -i.bak \
  38.         -e "s/\0malloc\0/\0mAlLoC\0/g;" \
  39.         -e "s/\0free\0/\0fReE\0/g;" \
  40.         -e "s/\0realloc\0/\0rEaLlOc\0/g;" \
  41.         -e "s/\0calloc\0/\0cAlLoC\0/g;" \
  42.         -e "s/\0cfree\0/\0cFrEe\0/g;" \
  43.         $(REAL_LIBMALLOC_OFILES) \
  44.         || (rm $(REAL_LIBMALLOC_OFILES) && exit 1)
  45.     rm -f *.bak
  46.  
  47. libdmalloc.a: $(OBJECTS)
  48.     ar cr libdmalloc.a $(OBJECTS) $(OTHERSOURCE)
  49.  
  50. libdmalloc.so: libdmalloc.a
  51.     ld -shared -all libdmalloc.a -lmpc -lexc -lmld -lmangle -o libdmalloc.so
  52.  
  53. libdmalloc.-g.so:
  54.     rm -f stacktrace.o dmalloc.o
  55.     cc -DGETWD_PATCH -c -g dmalloc.c
  56.     cc -DGETWD_PATCH -c -g stacktrace.c
  57.     ar cr libdmalloc.-g.a $(OBJECTS) $(OTHERSOURCE)
  58.     ld -shared -all libdmalloc.-g.a -lmpc -lexc -lmld -lmangle -o libdmalloc.-g.so
  59.